package org.veridiandynamics.client.view;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 * @author Talia
 * 
 * The panel that displays as a tab after a nurse logs in. Contains buttons to access all nurse tasks.
 *
 */
public class NursePanel extends AbstractPanelLayout 
{
	private JButton createPatientButton;
	private JButton deletePatientButton;
	private JButton editPatientButton;
	private JButton treatmentRecordButton;
	private JButton viewDailyAppointmentPageButton;
	private JTextField lastText;
	private JTextField firstText;
	private JTextField idText;
	private JPanel thisPanel;
	private JButton viewPatientButton;
	
	/**
	 * Constructor for panel. Creates panel.
	 */
	public NursePanel()
	{
		thisPanel = this;
		
		initialize();
		numCenterPanels = 3;
		panelLeft.setLayout(new BoxLayout(panelLeft, BoxLayout.Y_AXIS));
		panelLeft.add(Box.createRigidArea(new Dimension(10, 10)));

		JLabel patients = new JLabel("1.  Patients:");
		panelLeft.add(patients);
		panelLeft.add(Box.createRigidArea(new Dimension(0, 20)));
		createPatientButton = new JButton("Create Patient");
		createPatientButton.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent event) 
			{
				AddPatientPanel addpatientPanel = new AddPatientPanel(c1, thisPanel);
				add(addpatientPanel, "ADDPATIENTCARD");
				c1.show(thisPanel, "ADDPATIENTCARD");
			}
		});
		panelLeft.add(createPatientButton);
		panelLeft.add(Box.createRigidArea(new Dimension(0, 30)));
		deletePatientButton = new JButton("Delete Patient");
		deletePatientButton.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent event) 
			{
				DeletePatientPanel deletePatientPanel = new DeletePatientPanel(c1, thisPanel);
				add(deletePatientPanel, "DELETEPATIENTCARD");
				c1.show(thisPanel, "DELETEPATIENTCARD");
			}
		});
		panelLeft.add(deletePatientButton);
		panelLeft.add(Box.createRigidArea(new Dimension(0, 30)));
		editPatientButton = new JButton("Edit Patient");
		editPatientButton.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent event) 
			{
				EditPatientPanel editPatientPanel = new EditPatientPanel(c1, thisPanel);
				add(editPatientPanel, "EDITPATIENTCARD");
				c1.last(thisPanel);
			}
		});
		panelLeft.add(editPatientButton);
		
		panelLeft.add(Box.createRigidArea(new Dimension(0, 30)));
		viewPatientButton = new JButton("View Patients");
		viewPatientButton.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent event) 
			{
				ViewPatientPanel viewPatientPanel = new ViewPatientPanel(c1, thisPanel);
				add(viewPatientPanel, "VIEWPATIENTCARD");
				c1.last(thisPanel);
			}
		});
		panelLeft.add(viewPatientButton);
		
		panelCenter.setLayout(new BoxLayout(panelCenter, BoxLayout.Y_AXIS));
		panelCenter.add(Box.createRigidArea(new Dimension(20, 10)));
		JLabel treatmentRecordLabel = new JLabel("2.  Create Treatment Record:");
		panelCenter.add(treatmentRecordLabel);
		panelCenter.add(Box.createRigidArea(new Dimension(0, 20)));
		treatmentRecordButton = new JButton("Create Record");
		panelCenter.add(treatmentRecordButton);
		treatmentRecordButton.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent event) 
			{
				CreateTreatmentRecordPanel createTreatmentPanel = new CreateTreatmentRecordPanel(c1, thisPanel);
				add(createTreatmentPanel, "CREATETREATMENTCARD");
				c1.show(thisPanel, "CREATETREATMENTCARD");
			}
		});
		
		panelEast.setLayout(new BoxLayout(panelEast, BoxLayout.Y_AXIS));
		panelEast.add(Box.createRigidArea(new Dimension(20, 10)));
		JLabel viewAppointments = new JLabel("3.  View the Daily Appointments:");
		panelEast.add(viewAppointments);
		panelEast.add(Box.createRigidArea(new Dimension(0, 20)));
		viewDailyAppointmentPageButton = new JButton("View Daily Appointment Page");
		panelEast.add(viewDailyAppointmentPageButton);
		viewDailyAppointmentPageButton.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent event) 
			{
				ViewDailyAppointmentsPanel viewAppointments = new ViewDailyAppointmentsPanel(c1, thisPanel);
				add(viewAppointments, "APPOINTMENTSCARD");
				c1.show(thisPanel, "APPOINTMENTSCARD");
			}
		});
		
		
	}
}